#                                                                    -*-Perl-*-

$description = "\
The following test creates a makefile to test the warning function.";

$details = "";

run_make_test(q!ifdef WARNING1
$(warning warning is $(WARNING1))
endif

ifdef WARNING2
$(warning warning is $(WARNING2))
endif

ifdef WARNING3
all: some; @echo hi $(warning warning is $(WARNING3))
endif

ifdef WARNING4
all: some; @echo hi
#TAB#@echo there $(warning warning is $(WARNING4))
endif

some: ; @echo Some stuff
!,
              "WARNING1=yes", "#MAKEFILE#:2: warning is yes\nSome stuff\n");

run_make_test(undef, "WARNING2=no",
              "#MAKEFILE#:6: warning is no\nSome stuff\n");

run_make_test(undef, "WARNING3=maybe",
              "Some stuff\n#MAKEFILE#:10: warning is maybe\nhi\n");

run_make_test(undef, "WARNING4=definitely",
              "Some stuff\n#MAKEFILE#:15: warning is definitely\nhi\nthere\n");

# Test linenumber offset

run_make_test(q!
all: one two
#TAB#$(warning in $@ line 3)
#TAB#@true
#TAB#$(warning in $@ line 5)

one two:
#TAB#$(warning in $@ line 8)
#TAB#@true
#TAB#$(warning in $@ line 10)
!,
              '', "#MAKEFILE#:8: in one line 8
#MAKEFILE#:10: in one line 10
#MAKEFILE#:8: in two line 8
#MAKEFILE#:10: in two line 10
#MAKEFILE#:3: in all line 3
#MAKEFILE#:5: in all line 5\n");

# This tells the test driver that the perl test script executed properly.
1;
